package com.guage.zookeeper;
import org.apache.zookeeper.CreateMode;
import org.I0Itec.zkclient.ZkClient;
import org.I0Itec.zkclient.serialize.SerializableSerializer;

/**
 * 节点创建
 * @author john
 *
 */
public class CreateNode {

	public static void main(String[] args) {
		ZkClient zc = new ZkClient("192.168.222.135:2181", 10000, 10000, new SerializableSerializer());
		System.out.println("conneted ok!");

		User user = new User();
		user.setId(1);
		user.setName("test");
		String path = zc.create("/ydch2", user, CreateMode.PERSISTENT);
		System.out.println("created path:" + path);
	}

}
